#!/bin/sh

#
# This file is released under the terms of the Artistic License.
# Please see the file LICENSE, included in this package, for details.
#
# Copyright (C) 2002-2010 Mark Wong & Open Source Development Labs, Inc.
#

while getopts "d:p:" OPT; do
	case ${OPT} in
	d)
		DBT5DBNAME=${OPTARG}
		;;
	p)
		PORT=${OPTARG}
		;;
	esac
done

if [ "x${DBT5DBNAME}" = "x" ]; then
	echo "DBT5DBNAME not defined."
	exit 1
fi

if [ ! "x${PORT}" = "x" ]; then
	PORTOPT="-p ${PORT}"
fi

dropdb ${PORTOPT} ${DBT5DBNAME} || exit 1
